<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div>
        <!-- 搜索 -->
        <label class="el-form-item-label">储位编码</label>
        <el-input v-model="query.storageCode" clearable placeholder="储位编码" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">所属任务编号</label>
        <el-input v-model="query.wmsTaskNo" clearable placeholder="所属任务编号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">异常类型</label>
        <el-input v-model="query.errorType" clearable placeholder="异常类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <!-- <el-table-column type="selection" width="55" /> -->
        <el-table-column prop="storageId" label="储位id" />
        <el-table-column prop="storageCode" label="储位编码" />
        <el-table-column prop="wmsTaskNo" label="所属任务编号" />
        <el-table-column prop="errorType" label="异常类型" />
        <el-table-column prop="status" label="状态" />
        <el-table-column prop="createTime" label="创建时间" />
        <!-- <el-table-column v-if="checkPer(['admin','taskException:edit','taskException:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column> -->
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudTaskException from '@/api/work/missionError'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
// import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = { id: null, storageId: null, storageCode: null, wmsTaskNo: null, errorType: null, status: null, createTime: null, createName: null, updateTime: null, updateName: null }
export default {
  name: 'MissionError',
  components: { pagination, crudOperation, rrOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: 'taskException', url: 'api/taskException', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTaskException },
      optShow: {
        add: false,
        reset: true,
        edit: false,
        download: true,
        del: false
      }
    })
  },
  data() {
    return {
      permission: {
        add: ['admin', 'taskException:add'],
        edit: ['admin', 'taskException:edit'],
        del: ['admin', 'taskException:del']
      },
      rules: {
      }
    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
